package cn.mavor.day0906;

abstract class Airplane {
    protected int weight;
    protected int flightHeight;

    public Airplane(int weight, int flightHeight) {
        this.weight = weight;
        this.flightHeight = flightHeight;
    }

    public abstract void takeOff();
    public abstract void accelerate();
    public abstract void land();

    public int getWeight() {
        return weight;
    }

    public int getFlightHeight() {
        return flightHeight;
    }
}

class PassengerPlane extends Airplane {
    private int seatCount;  // 座位数

    public PassengerPlane(int weight, int flightHeight, int seatCount) {
        super(weight, flightHeight);
        this.seatCount = seatCount;
    }

    public int getSeatCount() {
        return seatCount;
    }

    @Override
    public void takeOff() {
        System.out.println("客机以客机独特的方式起飞了！！");
    }

    @Override
    public void accelerate() {
        System.out.println("观众朋友们，客机加速了！客机加速了！");
    }

    @Override
    public void land() {
        System.out.println("客机以客机独特的方式降落了！！");
    }
}

class FighterPlane extends Airplane {
    private int missileCount;  // 弹头数

    public FighterPlane(int weight, int flightHeight, int missileCount) {
        super(weight, flightHeight);
        this.missileCount = missileCount;
    }

    public int getMissileCount() {
        return missileCount;
    }

    @Override
    public void takeOff() {
        System.out.println("战斗机嗖一下起飞了！");
    }

    @Override
    public void accelerate() {
        System.out.println("战斗机现在开始超！级！加！速！");
    }

    @Override
    public void land() {
        System.out.println("战斗机嗖一下降落了！");
    }

    public void fireMissiles() {
        System.out.println("战斗机开炮！");
    }

    public void lowAltitudeManeuver() {
        System.out.println("战斗机正在低空盘旋！");
    }
}


class Pilot {
    public void testFly(Airplane airplane) {
        airplane.takeOff();
        airplane.accelerate();
        airplane.land();
    }
}

public class Plane {
    public static void main(String[] args) {
        // 创建客机
        PassengerPlane passengerPlane = new PassengerPlane(20000, 10000, 300);
        // 创建战斗机
        FighterPlane fighterPlane = new FighterPlane(15000, 15000, 12);

        // 创建飞行员
        Pilot pilot = new Pilot();

        // 驾驶客机进行飞行测试
        System.out.println("测试下客机：");
        pilot.testFly(passengerPlane);

        // 驾驶战斗机进行飞行测试
        System.out.println("\n测试下战斗机：");
        pilot.testFly(fighterPlane);
    }
}